package com.wecon.springdemo.ejob;

import org.apache.shardingsphere.elasticjob.api.ShardingContext;
import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * @description:
 * @author: Weikang Wang
 * @date: 2020/12/16 16:49
 */

@Component
public class MyJob implements SimpleJob {
    private static final Logger logger = LoggerFactory.getLogger(MyJob.class);

    /**
     * @param: shardingContext
     * @description: 作业开发
     * @return: void
     * @author: Weikang Wang
     * @date: 2020/12/16 16:49
     */

    @Override
    public void execute(ShardingContext shardingContext) {
        logger.info("定时任务正在进行……" + shardingContext.toString());
        System.out.println("定时任务正在进行:" + LocalDateTime.now());
    }

}
